#include<iostream>

using namespace std;
void Square(int m, int n, int &j, int &k)
{
	/********** BEGIN **********/
	int area=m*n;
	int r=n;
	while(r){
		r=m%n;
		m=n;
		n=r;
		///cout<<r<<endl;
	}
	j=m;
	k=area/(m*m);
	
	/********** END **********/
}
int main(){
	int m,n,j,k;
	cin>>m>>n;
	Square(m,n,j,k);
	cout<<j<<endl<<k<<endl;
	return 0;
}
